package br.ufrj.nce.linkit;

/*
 *******************************************************************************
 *******************************************************************************
 ********************** CLASSE Ajuda - versaoo 1.0     *******************
 *******************************************************************************
 *   Esta classe exibe janela com a ajuda do programa                         *                                                                 *
 *******************************************************************************
 *******************************************************************************
*/
import java.awt.*;
import java.awt.event.*;
import java.awt.peer.LightweightPeer;

import javax.swing.*;
import javax.swing.event.*;


public class Ajuda extends JFrame 
                        implements ActionListener {
   
    
    public Ajuda(String windowTitle) {
    	
    	super(windowTitle); 
        setBackground(Color.lightGray) ;
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
            }
          });
        
        JButton botaoOk = new JButton("Fechar");
        botaoOk.setActionCommand("fechar");
        botaoOk.addActionListener(this);        
        
        JTextArea ajuda = new JTextArea();
        ajuda.setBackground(Color.lightGray);
        ajuda.setFont(new Font("Helvetica",Font.BOLD,14));
        ajuda.setEditable(false);
        ajuda.setText("Para contactar o administrador, \nenvie email para ffs@nce.ufrj.br");
        
        Container container = getContentPane();
        
        JPanel pcima = new JPanel();        
        pcima.setLayout(new BorderLayout());
        pcima.setPreferredSize(new Dimension(100,60));
        pcima.add(ajuda);
        
        JPanel pbaixo = new JPanel();
        pbaixo.setBackground(Color.lightGray);
        pbaixo.setLayout(new GridLayout(0,4));        
        pbaixo.add(botaoOk);          
        
        container.setLayout(new BorderLayout());
        container.add(pcima,BorderLayout.CENTER);
        container.add(pbaixo,BorderLayout.SOUTH);
        
        setResizable(false);
        
        //Add a listener for window events
        addWindowListener(new WindowAdapter() {          	     
           	public void windowClosing(WindowEvent e) {
        		dispose();
        	}  
        });
        
    }
    
    // Tratamento de evento para o click no botao OK
    public void actionPerformed(ActionEvent e) {
        
    	if (e.getActionCommand().equals("fechar")) {           
            dispose();
        } else {           
            dispose();
        }

    }    

}
